<!DOCTYPE html>
<html>
<head>
  <title></title>
  #parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak>
  <div v-show="showList">
    <Row :gutter="16">
      <div class="search-group">
        <i-col span="4">
          <i-input v-model="q.goodsName" @on-enter="query" placeholder="商品名称"/>
        </i-col>
        <i-button @click="query">查询</i-button>
      </div>
      <div class="buttons-group">
        #if($shiro.hasPermission("product:save"))
        <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
        #end
        <!--#if($shiro.hasPermission("product:update"))-->
        <!--<i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>-->
        <!--#end-->
        #if($shiro.hasPermission("product:delete"))
        <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
        #end
      </div>
    </Row>
    <table id="jqGrid"></table>
    <div id="jqGridPager"></div>
  </div>

  <Card v-show="!showList">
    <p slot="title">{{title}}</p>
    <i-form ref="formValidate" :model="product" :rules="ruleValidate" :label-width="80">
      <Form-item label="商品" prop="goodsId">
        <i-select v-model="product.goodsId" filterable @on-change="changeGoods" label-in-value>
          <i-option v-for="goods in goodss" :value="goods" :key="goods.id">{{goods.name}}</i-option>
        </i-select>
      </Form-item>
      <Form-item label="商品规格" prop="goodsSpecificationIds" v-if="goodsId>0">
        <Checkbox-group v-model="attribute" @on-change="changeAttributes">
          <Checkbox v-for="item in specifications" :label="item">
            <span>{{item.name}}</span>
          </Checkbox>
        </Checkbox-group>
      </Form-item>


      <Form-item v-for="(item,i) in attribute" :label="item.name" :key="i">
        <i-select v-model="params[i].param" filterable multiple>
          <i-option v-for="citem in params[i].ggArr" :value="citem.id" :key="citem.id">
            {{citem.value}}
          </i-option>
        </i-select>
      </Form-item>
      <Form-item label="商品序列号" prop="goodsSn">
        <i-input v-model="product.goodsSn" placeholder="商品序列号"/>
      </Form-item>
      <Form-item label="商品库存" prop="goodsNumber">
        <Input-number :min="0" :step="1" v-model="product.goodsNumber" placeholder="商品库存"
                      style="width: 188px;"/>
      </Form-item>
      <Form-item label="零售价格" prop="retailPrice">
        <Input-number :min="0" :step="1" v-model="product.retailPrice" placeholder="零售价格"
                      style="width: 188px;"/>
      </Form-item>
      <Form-item label="市场价格" prop="marketPrice">
        <Input-number :min="0" :step="1" v-model="product.marketPrice" placeholder="市场价格"
                      style="width: 188px;"/>
      </Form-item>
      <Form-item label="团购价格(元)" prop="groupPrice" v-if="isSecKill==3">
        <Input-number :min="0" :step="1" v-model="product.groupPrice" placeholder="团购价格(元)"
                      style="width: 188px;"/>
      </Form-item>
      <Form-item>
        <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
        <i-button type="warning" @click="reload" style="margin-left: 8px"/>
        返回</i-button>
        <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置
        </i-button>
      </Form-item>
    </i-form>
  </Card>
</div>

<script src="${rc.contextPath}/js/shop/product.js?_${date.systemTime}"></script>
</body>
</html>